<?php
$collection = isset($collection) ? $collection :false;
if ($collection) {
  $group = $collection->groups;
  if (!$group) $group = array();
}
?>  
<?php foreach ($group as $g):?>
    <div class='tags' style='padding-top:10px;height:50px;width:100%;'>
      <span style='margin-left:10px;' class='label label-info'><?php echo $g->name;?></span>
      <ul> 
      <?php $tags = explode(',', $g->tags); foreach ($tags as $t):?>
        <li><a class='label <?php if (isset($tag->name) AND $t==$tag->name) echo 'label-success';?>' href='/gallery/?cid=<?php echo $collection->id;?>&tag=<?php echo urlencode($t);?>'><?php echo $t;?></a></li>
      <?php endforeach;?>
      <ul>
    </div>
    <div style='height:5px;clear:both;'></div>
<?php endforeach;?>
<style>
.tags li{
list-style:none;
float:left;
margin-left:5px;
margin-top:5px;
}
.tags ul{
margin:0px;
margin-top:10px;
margin-left:10px;
}
</style>
